import { reactive, toRefs } from 'vue'
// 上传头像逻辑
export const useUploadEffect = () => {
  const state = reactive({
    fileList: [],
    showUpload: true
  })

  const afterRead = (file: File) => {
    console.log('file:', file)
    // http 发送给后台信息
    state.showUpload = false
  }

  const afterDelete = () => {
    console.log('afterDelete')
    state.showUpload = true
  }
  const { fileList, showUpload } = toRefs(state)
  return { fileList, showUpload, afterRead, afterDelete }
}
